<script setup lang="ts">
import {computed, ref} from "vue";
import {useRoute} from "vue-router";


const route = useRoute();
const isLoginPage = computed(() => route.name === "Login" || "/"); // 根据路由名称判断是否是登录页面
import {useRouter} from "vue-router";
import CenterHeader from "@/views/center/centerHeader.vue";
import Left from "@/views/left/index.vue";
import Right from "@/views/right/index.vue";
import Login from "@/views/Login.vue";
import Home from "@/views/home.vue";

const currentComponent = ref<string>();

// 定义是否折叠侧边栏的状态
const isCollapse = ref(false);

// 获取路由对象
// const route = useRoute();
const router = useRouter();

// 处理菜单项展开事件
const handleOpen = (key: string, keyPath: string[]) => {
  console.log("open", key, keyPath);
};

// 处理菜单项关闭事件
const handleClose = (key: string, keyPath: string[]) => {
  console.log("close", key, keyPath);
};


</script>
<template>
  <div class="common-layout">
    <el-container v-if="isLoginPage">
      <el-main>
        <Login />
      </el-main>
    </el-container>
    <el-container v-else>
      <home />
    </el-container>
  </div>
</template>

<style scoped>
.common-layout {
  /* display: flex; */
  width: 100vw;
  height: 100vh;
  margin: 0; /* 确保没有外边距 */
  padding: 0; /* 确保没有内边距 */
}



</style>
